<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>JS无形装逼，最为致命</title>

    <script type="text/javascript">

        // 创建过去七天的数组
        console.log([...Array(7).keys()].map(days => new Date(Date.now() - 86400000 * days)));

        // 生成长度为11的随机字母数字字符串
        console.log(Math.random().toString(36).substring(2));

        // 随机更改数组元素顺序，混淆数组
        console.log(((arr) => arr.slice().sort(() => Math.random() - 0.5))([1, 2, 3, 4, 5]));

        // 生成随机十六进制代码 如：'#c618b2'
        console.log('#' + Math.floor(Math.random() * 0xffffff).toString(16).padEnd(6, '0'));

        // 数组去重
        console.log([...new Set([1, 1, 2, 2, 2, 3])]);

        // 方便快捷创建特定大小的数组
        console.log([...Array(3).keys()]);

        // 用字符串返回一个键盘图形
        console.log((_=>[..."`1234567890-=~~QWERTYUIOP[]\\~ASDFGHJKL;'~~ZXCVBNM,./~"].map(x=>(o+=`/${b='_'.repeat(w=x<y?2:' 667699'[x=["BS","TAB","CAPS","ENTER"][p++]||'SHIFT',p])}\\|`,m+=y+(x+'    ').slice(0,w)+y+y,n+=y+b+y+y,l+=' __'+b)[73]&&(k.push(l,m,n,o),l='',m=n=o=y),m=n=o=y='|',p=l=k=[])&&k.join`
`)());

        // 参考：https://juejin.im/post/5cc55eb5e51d456e577f93f0
    </script>

    <script type="text/javascript">

        // 单行写一个评级组件
        var rate = 1;
        console.log("★★★★★☆☆☆☆☆".slice(5 - rate, 10 - rate));
        rate = 2;
        console.log("★★★★★☆☆☆☆☆".slice(5 - rate, 10 - rate));
        rate = 3;
        console.log("★★★★★☆☆☆☆☆".slice(5 - rate, 10 - rate));
        rate = 4;
        console.log("★★★★★☆☆☆☆☆".slice(5 - rate, 10 - rate));
        rate = 5;
        console.log("★★★★★☆☆☆☆☆".slice(5 - rate, 10 - rate));

        // 优雅代码
        console.log( (!(~+[])+{})[--[~+""][+[]]*[~+[]] + ~~!+[]]+({}+[])[[~!+[]]*~+[]] );
        console.log( ([][[]]+[])[+!![]]+([]+{})[!+[]+!![]] );

        // 参考：https://blog.csdn.net/qq_36279445/article/details/77507791
    </script>
</head>

<body onload="setInterval(()=>document.body.innerHTML=new Date().toLocaleString().split(' ')[1])">

</body>
</html>